// page/member/code.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },
  onShow: function () {
    var that = this;
    that.request();
  },

  // 网络请求
  request: function () {
    var that = this
    wx.request({
      url: getApp().globalData.host + "&m=User&a=my_ewm", //仅为示例，并非真实的接口地址
      data: {
        "uid": getApp().globalData.uid
      },
      header: {
        'content-type': 'application/json', // 默认值
      },
      method: "GET",
      success: function (res) {
        console.log(res.data)
        console.log(res.data.ewm)
        console.log("https:\/\/xiaochengxu.xm-ttyc.com\/Uploads\/ewm\/user_Mw==.jpg")
        //请求成功
        if (res.data.status == 1) {
          that.setData({
            isHide: true,
            data: res.data
          })
        } else {//请求失败
          wx.showToast({
            title: res.data.info,
          })
        }
      },
      fail: function (res) {
        wx.showToast({
          title: "请求失败",
        })
      }
    })
  },

  // 分享
  onShareAppMessage: function (res) {
    var uid = getApp().globalData.uid;
    var that = this;
    var app = getApp()
    var scene = that.data.scene
    console.log(that.data.scene)
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '兴祥安驾校',
      path: 'page/member/code?scene=scene',
      success: function (res) {
        // 转发成功
        wx.request({
          url: app.globalData.host + '&g=App&m=Index&a=feedback',
          data: {
            scene: scene
          },
          header: {
            'content-type': 'application/json'
          },
        })
      },
      fail: function (res) {
        // 转发失败
      }
    }
  }
})